package app.netant.book.xiaoshuotxt;

import cn.lily.com.enviroment.Enviroment;
import app.netant.book.base.BaseDetail;
import app.netant.book.base.BaseEntity;
import app.netant.book.base.BasePage;
import app.netant.book.base.BaseRoot;

public class XiaoShuoTxtRoot extends BaseRoot {
	
	public XiaoShuoTxtRoot(){
		this.homeUrl = "http://www.xiaoshuotxt.org/top/allbook.php?page=0";
		this.pageUrl = "http://www.xiaoshuotxt.org/top/allbook.php?page=";
		this.tableKey = "xiaoshuotxt";
	}

	@Override
	public String buildUrl(int pageIdx) {
		if(pageIdx==1){
			return this.homeUrl;
		}
		return this.pageUrl + (pageIdx-1)+".html";
	}

	@Override
	public BasePage buildPage(String url) {
		return new XiaoShuoTxtPage(url);
	}

	@Override
	public BaseDetail buildDetail(String url) {
		return new XiaoShuoTxtDetail(url);
	}

	@Override
	public BaseEntity buildEntity() {
		return new XiaoShuoTxtEntity();
	}
	
	@Override
	public void afterEntity(BaseEntity entity) {
		
	}
	
	public static void main(String[] args) {
		
		Enviroment.createEnv();
		Enviroment.getEnv().getLogBean().beginLog();
		
		XiaoShuoTxtRoot root = new XiaoShuoTxtRoot();
		root.analyse(170,327);
		//root.excepCycle();
	}


	
}
